A film grain effect. More...
Public Member Functions | |
FilmGrainEffect () | |
~FilmGrainEffect () | |
virtual EFFECT_TYPE | getType () const override |
nkGraphics::Texture * | getSourceTexture () const |
float | getStrength () const |
bool | getRgbNoise () const |
bool | getBlendGrainInTarget () const |
void | setSourceTexture (nkGraphics::Texture *value) |
void | setStrength (float value) |
void | setRgbNoise (bool value) |
void | setBlendGrainInTarget (bool value) |
virtual bool | load () override |
virtual void | unload () override |
![]() | |
Effect () | |
virtual | ~Effect () |
nkMemory::StringView | getName () const |
nkGraphics::Shader * | getShader () const |
void | setName (const nkMemory::StringView &value) |
A film grain effect.
This effect imitates the noise often present in pictures taken from a camera. Some potential causes can be dirt or imperfections on the sensor lens, compression artifacts, or dust on the film. It is useful to add a sense of reality to an image, by adding imperfection usually found when taking real pictures. This effect offers different settings to make the effect look different, but also to make it adapt to different situations.
nkAstraeus::FilmGrainEffect::FilmGrainEffect | ( | ) |
Default constructor. See EffectManager::createOrRetrieve().
nkAstraeus::FilmGrainEffect::~FilmGrainEffect | ( | ) |
Destructor.
|
overridevirtual |
Implements nkAstraeus::Effect.
nkGraphics::Texture* nkAstraeus::FilmGrainEffect::getSourceTexture | ( | ) | const |
float nkAstraeus::FilmGrainEffect::getStrength | ( | ) | const |
bool nkAstraeus::FilmGrainEffect::getRgbNoise | ( | ) | const |
bool nkAstraeus::FilmGrainEffect::getBlendGrainInTarget | ( | ) | const |
void nkAstraeus::FilmGrainEffect::setSourceTexture | ( | nkGraphics::Texture * | value | ) |
Sets the texture to use as input. This texture is only required when the blending functionality is turned off.
value | The texture to use as input for the effect. |
void nkAstraeus::FilmGrainEffect::setStrength | ( | float | value | ) |
Sets the strength of the effect. Defaults to 0.15.
value | The strength of the effect wanted. |
void nkAstraeus::FilmGrainEffect::setRgbNoise | ( | bool | value | ) |
Sets whether the noise should randomize its output on the RGB channels independently, or with one value on all of them at once. If false, this means that noise will be applied like : r + n, g + n, b + n. If true, this means that noise will be applied like : r + n0, g + n1, b + n2. Defaults to false.
value | Whether the noise should be independent on each channel (true) or not (false). |
void nkAstraeus::FilmGrainEffect::setBlendGrainInTarget | ( | bool | value | ) |
Sets whether the effect should blend in the target, or rather process the source texture before writing the output. See FilmGrainEffectUtils::prepareBlendStateForGrainBlending() to setup a compatible BlendState to use in the pass along with the effect. Defaults to false.
value | Whether the noise should be blended in target (true) or not (false). |
|
overridevirtual |
See Effect::load().
Implements nkAstraeus::Effect.
|
overridevirtual |
See Effect::unload().
Implements nkAstraeus::Effect.